# # encoding:utf-8
# import xlrd
# class ExcelUtil:
#     def __init__(self, excelPath, sheetName):
#         self.data = xlrd.open_workbook(excelPath)
#         self.table = self.data.sheet_by_name(sheetName)# 获取第一行作为key值
#         self.keys = self.table.row_values(0)# 获取总行数
#         self.rowNum = self.table.nrows# 获取总列数
#         self.colNum = self.table.ncols
#     def dict_data(self):
#         if self.rowNum <= 1:print("测试用例总行数小于1")
#         else:
#             r = []
#             j = 1
#             for i in range(self.rowNum - 1):
#                 s = {}  ## 从第二行取对应values值
#                 values = self.table.row_values(j)
#             for x in range(self.colNum):
#                 s[self.keys[x]] = values[x]
#                 r.append(s)j += 1
#                 return rif __name__ == "__main__":filepath = "D:\SourceCode\daas_InterfacesAutoTest\config\daas_case.xlsx"sheetName = "test_case"data = ExcelUtil(filepath, sheetName)print data.dict_data()
import os

import xlrd

# import xlrd3

# abs_path = os.path.dirname(os.path.abspath(__file__))
# excel文件路径
# file_path = os.path.join(abs_path, '..', 'files', 'searKey.xlsx')

# 创建excel对象
work_book = xlrd.open_workbook('../data/testdata/searKey.xlsx')
# 创建表对象
sheet = work_book.sheet_by_name("Sheet1")

# 获取行数
# print(sheet.nrows)
# 获取列数
# print(sheet.ncols)
# 获取第一列内容
# print(sheet.col_values(0))
for i in range(0, sheet.nrows):
    data = sheet.row_values(i)
zip(data)